<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('大区会长收货地址列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <input id="agentId" name="agentId" th:value="${agentId}" type="hidden">
            <div class="col-sm-12 select-table table-bordered">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('zsyh:agentaddress:edit')}]];
        var removeFlag = [[${@permission.hasPermi('zsyh:agentaddress:remove')}]];
        var isDefaultDatas = [[${@dict.getType('zsyh_yesno')}]];
        var prefix = ctx + "zsyh/agentaddress";

        $(function() {
            var options = {
                url: prefix + "/list?agentId="+$("#agentId").val(),
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                modalName: "大区会长收货地址",
                columns: [{
                    field : 'Number',
                    title : '序号',
                    align: 'center',
                    width: 20,
                    formatter : function(value, row, index) {
                        var pageSize = $('#bootstrap-table').bootstrapTable('getOptions').pageSize;//通过表的#id 可以得到每页多少条
                        var pageNumber = $('#bootstrap-table').bootstrapTable('getOptions').pageNumber;//通过表的#id 可以得到当前第几页
                        return pageSize * (pageNumber - 1) + index + 1;//返回每条的序号： 每页条数 * （当前页 - 1 ）+ 序号
                    }
                },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                    {
                        field: 'addressName',
                        align: 'center',
                        title: '收货人'
                    },
                    {
                        field: 'addressPhone',
                        align: 'center',
                        title: '联系方式'
                    },
                {
                    field: 'addressDetail',
                    align: 'center',
                    title: '收货地址'
                },
                {
                    field: 'isDefault',
                    align: 'center',
                    title: '是否默认地址',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(isDefaultDatas, value);
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>